// 封装各种请求类型的函数，如：get，post，put，delete。
import service  from "@/utils/service"

export const POST= (url:string,data?:any)=>{
    data = data || {}
    return new Promise(function(resolve,reject){
       service.post(url,data)
       .then(res=>{
           resolve(res.data)
       })
       .catch(err=>{
           reject(err)
       })

   })
}

export const GET= (url:string,params?:any)=>{
    params = params || {};
    return new Promise(function(resolve,reject){
       service.get(url,{params})
       .then(res=>{
           resolve(res.data)
       })
       .catch(err=>{
           reject(err)
       })

   })
}